import { checkUrl } from '@/sheep/utils/checkUrlSuffix';
import { api as goodsApi } from '@/app/shop/admin/goods/goods.service';
import { api as couponApi } from '@/app/shop/admin/coupon/coupon.service';
import { api as dataApi } from '@/app/shop/admin/data/data.service';
import { api as activityApi } from '@/app/shop/admin/activity/activity.service';
import { api as categoryApi } from '@/app/shop/admin/category/category.service';
import { api as appApi } from '@/app/shop/admin/app/app.service';
import { color } from 'echarts';
import { size } from 'lodash';
import { name } from 'dayjs/locale/zh-cn';

// 主题
export const themeColor = {
  orange: {
    color1: '#FF6000',
    color2: '#FE832A',
  },
  golden: {
    color1: '#E9B461',
    color2: '#EECC89',
  },
  yellow: {
    color1: '#FFC300',
    color2: '#FDDF47',
  },
  black: {
    color1: '#484848',
    color2: '#6D6D6D',
  },
  green: {
    color1: '#2AAE67',
    color2: '#3ACD72',
  },
  purple: {
    color1: '#652ABF',
    color2: '#A36FFF',
  },
};

// 页面列表
export const pageTypeList = [
  {
    type: 'basic',
    label: '基础配置',
  },
  {
    type: 'index',
    label: '首页',
  },
  {
    type: 'home',
    label: '商城',
  },
  {
    type: 'user',
    label: '个人页',
  },
];

// 系统列表
export const systemList = [
  {
    type: 'android',
    label: 'Android',
    color: '#6F74E9',
  },
  {
    type: 'ios',
    label: 'IOS',
    color: '#333333',
  },
];

// 平台列表
export const platformList = [
  {
    type: 'WechatMiniProgram',
    label: '微信小程序',
    color: '#6F74E9',
  },
  {
    type: 'WechatOfficialAccount',
    label: '微信公众号',
    color: '#07C160',
  },
  {
    type: 'H5',
    label: 'H5',
    color: '#FC800E',
  },
  {
    type: 'App',
    label: 'APP',
    color: '#806AF6',
  },
];

// 基础列表
export const basicList = [
  {
    name: '应用设置',
    type: 'basic',
    data: [
      // {
      //     name: '启动页',
      //     type: 'splashScreen',
      // },
      // { name: '引导页', type: 'guidePage' },
      {
        name: '底部导航',
        type: 'tabbar',
      },
      {
        name: '悬浮按钮',
        type: 'floatMenu',
      },
      {
        name: '弹窗广告',
        type: 'popupImage',
      },
    ],
  },
  {
    name: '主题色',
    type: 'theme',
    data: [
      {
        name: '淘宝橙',
        type: 'orange',
      },
      {
        name: '香槟金',
        type: 'golden',
      },
      {
        name: '美团黄',
        type: 'yellow',
      },
      {
        name: '低奢黑',
        type: 'black',
      },
      {
        name: '微信绿',
        type: 'green',
      },
      {
        name: '尊贵紫',
        type: 'purple',
      },
    ],
  },
];

// 组件列表
export const compList = [
  {
    name: '会员组件',
    type: '0',
    show: ['user', 'diypage'],
    data: [
      {
        name: '会员卡片',
        type: 'userCard',
      },
      {
        name: '订单卡片',
        type: 'orderCard',
      },
      {
        name: '新订单卡片',
        type: 'orderCardNew',
      },
      {
        name: '资产卡片',
        type: 'walletCard',
      },
      {
        name: '卡券卡片',
        type: 'couponCard',
      },
    ],
  },
  {
    name: '基础组件',
    type: '1',
    data: [
      {
        name: '搜索框',
        type: 'searchBlock',
      },
      {
        name: '公告栏',
        type: 'noticeBlock',
      },
      {
        name: '菜单导航',
        type: 'menuButton',
      },
      {
        name: '列表导航',
        type: 'menuList',
      },
      {
        name: '轮播导航',
        type: 'menuSwiper',
      },
      {
        name: '宫格导航',
        type: 'menuGrid',
      },
      {
        name: '平台推荐',
        type: 'platformReco',
      },
	  {
		name:'菜单块',
		type:'menuBlock',
	  }
    ],
  },
  {
    name: '商品组件',
    type: '2',
    data: [
      {
        name: '商品卡片',
        type: 'goodsCard',
      },
      {
        name: '商品栏',
        type: 'goodsShelves',
      },
      {
        name: '商品列表02',
        type: 'goodsClass',
      },
      {
        name: '活动栏',
        type: 'activityShelves',
      },
      {
        name: '商城列表',
        type: 'shopGoodsList',
      },
      {
        name: '商城列表1',
        type: 'shopGoodsList1',
      },
      {
        name: '严选商品',
        type: 'yanxuangoods',
      },
      {
        name: '鲸囍店铺',
        type: 'jxshopBlock',
      },
      {
        name: '分类栏',
        type: 'categoryTabs',
      },
	  {
        name: '特价团',
        type: 'offerBlock',
      },
    ],
  },
  {
    name: '图文组件',
    type: '3',
    data: [
      {
        name: '图片展示',
        type: 'imageBlock',
      },
      {
        name: '图片展示1',
        type: 'imageBlock1',
      },
      {
        name: '图片轮播',
        type: 'imageBanner',
      },
      {
        name: '菜单轮播',
        type: 'menuBanner',
      },
      {
        name: '标题栏',
        type: 'titleBlock',
      },
      {
        name: '广告魔方',
        type: 'imageCube',
      },
      {
        name: '视频播放',
        type: 'videoPlayer',
      },
      {
        name: '辅助线',
        type: 'lineBlock',
      },
      {
        name: '富文本',
        type: 'richtext',
      },
      {
        name: '热区',
        type: 'hotzone',
      },
      {
        name: '分类区',
        type: 'category',
      },
    ],
  },
  {
    name: '营销组件',
    type: '4',
    data: [
      {
        name: '拼团',
        type: 'groupon',
      },
      {
        name: '秒杀',
        type: 'seckill',
      },
      {
        name: '积分商城',
        type: 'scoreGoods',
      },
      { name: '小程序直播', type: 'mplive' },
      {
        name: '优惠券',
        type: 'coupon',
      },
      {
        name: '推广卡片',
        type: 'promotionCard',
      },

      {
        name: '签到卡片',
        type: 'signCard',
      },
    ],
  },
  {
    name: '扩展组件',
    type: '5',
    data: [
      {
        name: '搜索导航',
        type: 'customNavbar',
      },
      {
        name: '个人中心',
        type: 'extend7',
      },
      {
        name: '团购列表',
        type: 'groupList',
      },
      {
        name: '列表分类',
        type: 'listClass',
      },
    ],
  },
  {
    name: '假日活动',
    type: '6',
    data: [
      {
        name: '空白占位符',
        type: 'blankView',
      },
      {
        name: '夏日焕新1',
        type: 'summerNewOne',
      },
      {
        name: '夏日焕新2',
        type: 'summerNewSecond',
      },
      {
        name: '五一嗨购1',
        type: 'wuyiOne',
      },
      {
        name: '五一嗨购2',
        type: 'wuyiTwo',
      },
    ],
  },
];

// 页面默认数据
export const initTemplateData = {
  basic: {
    // splashScreen: {
    //     status: false, // false|true
    //     src: '',
    //     countdown: 5,
    //     url: '',
    // },
    // guidePage: {
    //     status: false, // false|true
    //     list: [],
    // },
    tabbar: {
      mode: 1, // 1 2
      layout: 1, // 1=文字+图片 2=文字 3=图片
      inactiveColor: '#EEEEEE',
      activeColor: '#000000',
      list: [
        // {
        //     inactiveIcon: '',
        //     activeIcon: '',
        //     url: '',
        //     text: '',
        // }
      ],
      background: {
        type: 'color', // color=纯色 image=背景图
        bgImage: '',
        bgColor: '#FFFFFF',
      },
    },
    floatMenu: {
      show: 0, // 0|1
      mode: 1, // 1|2
      isText: 0, // 0|2
      list: [
        {
          src: '',
          url: '',
          title: {
            text: '',
            color: '',
          },
        },
      ],
    },
    popupImage: {
      list: [
        // {
        //     src: '',
        //     url: '',
        //     show:1
        // }
      ],
    },
    theme: 'orange',
  },
  home: {
    data: [],
    style: {
      background: {
        color: '#F6F6F6',
        src: '',
      },
      navbar: {
        mode: 'normal', // normal inner
        alwaysShow: 0, // 0 1
        type: 'color',
        color: '',
        src: '',
        list: {
          mp: [],
          app: [],
        },
      },
    },
  },
  user: {
    data: [
      {
        type: 'userCard',
        style: {
          marginLeft: 0,
          marginRight: 0,
          marginTop: 0,
          marginBottom: 10,
          borderRadiusTop: 0,
          borderRadiusBottom: 0,
          background: {
            type: 'color',
            bgImage: '',
            show:false,
            bgColor: '#FFFFFF',
          },
        },
      },
    ],
    style: {
      background: {
        color: '#F6F6F6',
        src: '',
      },
      navbar: {
        mode: 'normal', // normal inner
        alwaysShow: 0, // 0 1
        type: 'color',
        color: '',
        src: '',
        list: {
          mp: [],
          app: [],
        },
      },
    },
  },
  diypage: {
    data: [],
    style: {
      background: {
        color: '',
        src: '',
      },
      navbar: {
        mode: 'normal', // normal inner
        alwaysShow: 0, // 0 1
        type: 'color',
        color: '',
        src: '',
        list: {
          mp: [],
          app: [],
        },
      },
    },
  },
  index: {
    data: [],
    style: {
      background: {
        color: '#F6F6F6',
        src: '',
      },
      navbar: {
        mode: 'normal', // normal inner
        alwaysShow: 0, // 0 1
        type: 'color',
        color: '',
        src: '',
        list: {
          mp: [],
          app: [],
        },
      },
    },
  },
};

// 组件数据
export function cloneComponent(type, theme = 'orange') {
  let comp = {
    userCard: {
      type: 'userCard',
      data: {
        src: '',
        url: '',
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
         
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
        show:false,
      },
    },
    extend7: {
      type: 'extend7',
      data: {
        left: {
          src: '',
          title: '',
          url: '',
        },
        center: {
          src: '',
          title: '',
          url: '',
        },
        right: {
          src: '',
          title: '',
          url: '',
        }
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    orderCard: {
      type: 'orderCard',
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    orderCardNew: {
      type: 'orderCardNew',
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    walletCard: {
      type: 'walletCard',
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    couponCard: {
      type: 'couponCard',
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    searchBlock: {
      type: 'searchBlock',
      data: {
        placeholder: '',
        borderRadius: 0,
        keywords: [
          // {
          //     text: '',
          //     color: '#8C8C8C',
          // }
        ],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    noticeBlock: {
      type: 'noticeBlock',
      data: {
        mode: 1,
        src: checkUrl('/static/img/shop/decorate/notice-1.png'),
        title: {
          text: '',
          color: '#111111',
        },
        url: '',
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    menuSwiper: {
      type: 'menuSwiper',
      data: {
        layout: 1, // 1=图片+文字 2=图片
        col: 5, // 列数 3|4|5
        mode: 2, // 1 2 3行数 超出滑动
        list: [
          // {
          //     src: '',
          //     title: {
          //         text: '',
          //         color: '#000'
          //     },
          //     url: '',
          //     badge: {
          //         show: 0, // 0|1
          //         text: '',
          //         color: '#FFFFFF',
          //         bgColor: '#FF6000',
          //     },
          // }
        ],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    listClass: {
      type: 'listClass',
      data: {
        layout: 1, // 1=图片+文字 2=图片
        col: 6, // 列数 3|4|5
        row: 1, // 1 2 3行数 超出滑动
        list: [
          // {
          //     src: '',
          //     title: {
          //         text: '',
          //         color: '#000'
          //     },
          //     url: '',
          //     badge: {
          //         show: 0, // 0|1
          //         text: '',
          //         color: '#FFFFFF',
          //         bgColor: '#FF6000',
          //     },
          // }
        ],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    menuButton: {
      type: 'menuButton',
      data: {
        layout: 1, // 1=图片+文字 2=图片
        col: 3, // 列数 3|4|5
        row: 1, // 1 2 3行数 超出滑动
        list: [
          // {
          //     src: '',
          //     title: {
          //         text: '',
          //         color: '#000'
          //     },
          //     url: '',
          //     badge: {
          //         show: 0, // 0|1
          //         text: '',
          //         color: '#FFFFFF',
          //         bgColor: '#FF6000',
          //     },
          // }
        ],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    groupList: {
      type: 'groupList',
      data: {
        src: '',
        url: '',
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    menuList: {
      type: 'menuList',
      data: {
        list: [
          // {
          //     src: '',
          //     title: {
          //         text: '',
          //         color: '#333'
          //     },
          //     tip: {
          //         text: '',
          //         color: '#bbb'
          //     },
          //     url: '',
          // }
        ],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    menuGrid: {
      type: 'menuGrid',
      data: {
        col: 3, // 列数 3|4
        // border: 0, // 边框 0|1
        list: [
          {
            src: '',
            title: {
              text: '',
              color: '#333',
            },
            tip: {
              text: '',
              color: '#bbb',
            },
            url: '',
            badge: {
              show: 0, // 0|1
              text: '',
              color: '#FFFFFF',
              bgColor: '#FF6000',
            },
          },
        ],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    goodsClass: {
      type: 'goodsClass',
      data: {
        tabData: [
          {
            name: '热门商品',
          },
        ],
        tabIndex: 0,
        templateList: [
          {
            mode: 1,
            goodsFields: {
              title: {
                show: 1, // 0|1
                color: '#000',
              },
              subtitle: {
                show: 1, // 0|1
                color: '#999',
              },
              price: {
                show: 1, // 0|1
                color: '#ff3000',
              },
              original_price: {
                show: 1, // 0|1
                color: '#c4c4c4',
              },
              sales: {
                show: 1, // 0|1
                color: '#c4c4c4',
              },
              stock: {
                show: 0, // 0|1
                color: '#c4c4c4',
              },
            },
            buyNowStyle: {
              mode: 1,
              text: '立即购买',
              color1: themeColor[theme].color1,
              color2: themeColor[theme].color2,
              src: '',
              is_show: true,
            },
            tagStyle: {
              show: 0,
              src: '',
            },
            goodsIds: [],
            goodsList: [],
            borderRadiusTop: 0,
            borderRadiusBottom: 0,
            space: 8,
          },
        ],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '',
        },
        marginLeft: 8,
        marginRight: 8,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    shopGoodsList: {
      type: 'shopGoodsList',
      data: {
        goodsIds: [],
        goodsList: [],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '',
        },
        marginLeft: 8,
        marginRight: 8,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    shopGoodsList1: {
      type: 'shopGoodsList1',
      data: {
        goodsIds: [],
        goodsList: [],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '',
        },
        marginLeft: 8,
        marginRight: 8,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    summerNewOne: {
      type: 'summerNewOne',
      data: {
        goodsIds: [],
        goodsList: [],
      },
      marginTop:0,
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 0,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    summerNewSecond: {
      type: 'summerNewSecond',
      data: {
        goodsIds: [],
        goodsList: [],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 0,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    wuyiOne: {
      type: 'wuyiOne',
      data: {
        goodsIds: [],
        goodsList: [],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 0,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    wuyiTwo: {
      type: 'wuyiTwo',
      data: {
        goodsIds: [],
        goodsList: [],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 0,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    blankView: {
      type: 'blankView',
      data: {
        height:495,
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 0,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    goodsCard: {
      type: 'goodsCard',
      data: {
        mode: 1,
        goodsFields: {
          title: {
            show: 1, // 0|1
            color: '#000',
          },
          subtitle: {
            show: 1, // 0|1
            color: '#999',
          },
          price: {
            show: 1, // 0|1
            color: '#ff3000',
          },
          original_price: {
            show: 1, // 0|1
            color: '#c4c4c4',
          },
          sales: {
            show: 1, // 0|1
            color: '#c4c4c4',
          },
          stock: {
            show: 0, // 0|1
            color: '#c4c4c4',
          },
        },
        buyNowStyle: {
          mode: 1,
          text: '立即购买',
          color1: themeColor[theme].color1,
          color2: themeColor[theme].color2,
          src: '',
        },
        tagStyle: {
          show: 0,
          src: '',
        },
        goodsIds: [],
        goodsList: [],
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        space: 8,
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '',
        },
        marginLeft: 8,
        marginRight: 8,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    goodsShelves: {
      type: 'goodsShelves',
      data: {
        mode: 1,
        goodsFields: {
          title: {
            show: 1, // 0|1
            color: '#333',
          },
          price: {
            show: 1, // 0|1
            color: '#ff3000',
          },
        },
        tagStyle: {
          show: 0,
          src: '',
        },
        goodsIds: [],
        goodsList: [],
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        space: 0,
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    yanxuangoods: {
      type: 'yanxuangoods',
      data: {
        mode: 1,
        goodsFields: {
          title: {
            show: 1, // 0|1
            color: '#333',
          },
          price: {
            show: 1, // 0|1
            color: '#ff3000',
          },
        },
        tagStyle: {
          show: 0,
          src: '',
        },
        goodsIds: [],
        goodsList: [],
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        space: 0,
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    activityShelves: {
      type: 'activityShelves',
      data: {
        // goodsFields: {
        //   title: {
        //     show: 1, // 0|1
        //     color: '#333',
        //   },
        //   price: {
        //     show: 1, // 0|1
        //     color: '#ff3000',
        //   },
        // },
        cardList: [
          {
            bgImage: '',
            txt: '',
            url: '',
            goodsIds: [],
            goodsList: [],
          },
          {
            bgImage: '',
            txt: '',
            url: '',
            goodsIds: [],
            goodsList: [],
          },
        ],
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        space: 0,
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    customNavbar: {
      type: 'customNavbar',
      data: {
		src:'',
		searchText:'',
        navbar:{
			type:'image',
			color:'#ffffff',
			src:'',
		}
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
        // height: 300,
      },
    },
    promotionCard: {
      type: 'promotionCard',
      data: {
        cardList: [
          {
            txt: '',
            url: '',
          },
          {
            txt: '',
            url: '',
          },
        ],
        is_img: 0,
        img_url: '',
        path: '',
        goodsList: [],
        goodsIds: [],
        list: [
          {
            src: '',
            title: {
              text: '',
              color: '#333',
            },
            tip: {
              text: '',
              color: '#bbb',
            },
            url: '',
            badge: {
              show: 0, // 0|1
              text: '',
              color: '#FFFFFF',
              bgColor: '#FF6000',
            },
          },
        ],
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        space: 0,
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    platformReco: {
      type: 'platformReco',
      data: {
        title: {
          text: '公司产品',
          color: '#333'
        },
        list: []
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    jxshopBlock: {
      type: 'jxshopBlock',
      data: {
        shop: {
          text: '鲸囍严选',
          color: '#333'
        },
        btn: {
          text: '点击进入',
          color: '#fff',
          bgColor: '#FF5555',
          url: '',
        },
        goodsIds: [26778, 27321, 158771],
        goodsList: [],
		hotData:{
			text: '网红爆款',
			color: '#666',
			url: '',
		},
		hotGoodsIds: [],
        hotGoodsList: [],
		newData:{
			text: '新品上市',
			color: '#666',
			url: '',
		},
		newGoodsIds: [],
        newGoodsList: [],
		seckillData:{
			text: '秒杀',
			color: '#666',
			url: '',
		},
		seckillGoodsIds: [],
        seckillGoodsList: [],
	  },
	  style: {
	    background: {
	      type: 'color',
	      bgImage: '',
	      bgColor: '#FFFFFF',
	    },
	    marginLeft: 0,
	    marginRight: 0,
	    marginTop: 0,
	    marginBottom: 10,
	    borderRadiusTop: 0,
	    borderRadiusBottom: 0,
	    padding: 0,
	  },
	},
	categoryTabs: {
	  type: 'categoryTabs',
	  data: {
		list:[],
		id:'',
		activeStyle:{
			color:'#333',
			size:16,
		},
		inactiveStyle:{
			color:'#666',
			size:14,
		},
		line:{
			color:'#333',
		},
		height:40,
	  },
	  style: {
		background: {
		  type: 'color',
		  bgImage: '',
		  bgColor: '#FFFFFF',
		},
		marginLeft: 0,
		marginRight: 0,
		marginTop: 0,
		marginBottom: 10,
		borderRadiusTop: 0,
		borderRadiusBottom: 0,
		padding: 0,
	  },
	},
	menuBlock: {
		type: 'menuBlock',
		data: {
			col: 3, // 列数 3|4|5
			space: 0,
			radius:10,
			titleStyle:{
				color1:'#EFBEEB',
				color2:'#7E83D9',
			},
			titleArr:[
				{
					title:{
						text:'标题',
						color:'#333'
					}
				}
			],
			list: [
			  // {
			  //     src: '',
			  //     title: {
			  //         text: '',
			  //         color: '#000'
			  //     },
			  //     url: '',
			  //     badge: {
			  //         show: 0, // 0|1
			  //         text: '',
			  //         color: '#FFFFFF',
			  //         bgColor: '#FF6000',
			  //     },
			  // }
			],
		},
		style: {
		  background: {
			type: 'color',
			bgImage: '',
			bgColor: '#FFFFFF',
		  },
		  marginLeft: 0,
		  marginRight: 0,
		  marginTop: 0,
		  marginBottom: 10,
		  borderRadiusTop: 0,
		  borderRadiusBottom: 0,
		  padding: 0,
		},
	},
	offerBlock: {
		type: 'offerBlock',
		data: {
			btn1:{
				url:'',
				title:{
					text:'超引擎计划',
					color:'#333'
				},
				isMp:0,
				id:'',
				path:'',
				appid:'',
			},
			btn2:{
				src:'',
				url:'',
				title:{
					text:'',
					color:'#333'
				},
				isMp:0,
				id:'',
				path:'',
				appid:'',
			},
			btn3:{
				url:'',
				src:'',
				title:{
					text:'',
					color:'#333'
				},
				isMp:0,
				id:'',
				path:'',
				appid:'',
			},
		},
		style: {
		  background: {
			type: 'color',
			bgImage: '',
			bgColor: '#FFFFFF',
		  },
		  marginLeft: 0,
		  marginRight: 0,
		  marginTop: 0,
		  marginBottom: 10,
		  borderRadiusTop: 0,
		  borderRadiusBottom: 0,
		  padding: 0,
		},
	  },
    imageBlock1: {
      type: 'imageBlock1',
      data: {
        src: '',
        url: '',
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    imageBlock: {
      type: 'imageBlock',
      data: {
        src: '',
        url: '',
        title: '',
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    signCard: {
      type: 'signCard',
      data: {
        src: '',
        url: '',
        show:false,
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    menuBanner: {
      type: 'menuBanner',
      data: {
        space: 6,
        radius: 6,
        height: 120,
        leftRatio: 1,
        rightRatio: 1,
        rightTop: 1,
        rightBottom: 1,
        mode: 1,
        indicator: 1,
        menu1: '',
        menu1link: '',
        menu2: '',
        menu2link: '',
        indicator: 1,
        mp1: {
          isMp: 0,
          id: '',
          path: '',
          appid: '',
        },
        mp2: {
          isMp: 0,
          id: '',
          path: '',
          appid: '',
        },
        list: [
        ],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 10,
        marginRight: 10,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
        aiShow: 0,
        aiImg: '',
        aiUrl: '',
        // height: 300,
      },
    },
    imageBanner: {
      type: 'imageBanner',
      data: {
        mode: 1, // 1 2
        indicator: 1, // 1 2
        autoplay: false,
        interval: 3000,
        list: [
          // {
          //     title: '',
          //     type: 'image',
          //     src: '',
          //     poster: '',
          //     url: ''
          // }
        ],
        space: 0,
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
        // height: 300,
      },
    },
    titleBlock: {
      type: 'titleBlock',
      data: {
        src: checkUrl('/static/img/shop/decorate/title-1.png'),
        location: 'left', // left=居左 center=居中
        skew: 0,
        title: {
          text: '标题栏',
          color: '#111111',
          textFontSize: 14,
          other: [], // bold=加粗 italic=倾斜
        },
        subtitle: {
          text: '副标题',
          color: '#8c8c8c',
          textFontSize: 12,
          other: [], // bold=加粗 italic=倾斜
        },
        more: {
          show: 0, // 0=不显示 1=显示
          url: '',
        },
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 0,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
        height: 40,
      },
    },
    imageCube: {
      type: 'imageCube',
      data: {
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        space: 0,
        list: [
          // {
          //     width: 0,
          //     height: 0,
          //     top: 0,
          //     left: 0,
          //     src: '',
          //     url: ''
          // }
        ],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    videoPlayer: {
      type: 'videoPlayer',
      data: {
        videoUrl: '', // 视频地址
        src: '', // 视频封面
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
        height: 300,
      },
    },
    lineBlock: {
      type: 'lineBlock',
      data: {
        mode: 'solid', // solid dotted dashed
        lineColor: '',
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        padding: 0,
      },
    },
    richtext: {
      type: 'richtext',
      data: {
        id: '',
        title: '',
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        padding: 0,
      },
    },
    hotzone: {
      type: 'hotzone',
      data: {
        src: '',
        list: [],
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        // marginLeft: 0,
        // marginRight: 0,
        // marginTop: 0,
        // marginBottom: 10,
        // padding: 0,
      },
    },
    category: {
      type: 'category',
      data: {
        src: '',
        url: '',
        title: ''
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
      },
    },
    groupon: {
      type: 'groupon',
      data: {
        activityId: '',
        activityList: [],
        goodsList: [],
        mode: 1,
        tagStyle: {
          show: 0, // 0,1
          src: '',
        },
        goodsFields: {
          title: {
            show: 1, // 0|1
            color: '#000',
          },
          subtitle: {
            show: 1, // 0|1
            color: '#999',
          },
          price: {
            show: 1, // 0|1
            color: '#FF0000',
          },
          original_price: {
            show: 1, // 0|1
            color: '#C4C4C4',
          },
          sales: {
            show: 1, // 0|1
            color: '#c4c4c4',
          },
        },
        buyNowStyle: {
          mode: 1,
          text: '立即拼团',
          color1: themeColor[theme].color1,
          color2: themeColor[theme].color2,
          src: '',
        },
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        space: 0,
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    seckill: {
      type: 'seckill',
      data: {
        activityId: '',
        activityList: [],
        goodsList: [],
        mode: 1,
        tagStyle: {
          show: 0, // 0,1
          src: '',
        },
        goodsFields: {
          title: {
            show: 1, // 0|1
            color: '#000',
          },
          subtitle: {
            show: 1, // 0|1
            color: '#999',
          },
          price: {
            show: 1, // 0|1
            color: '#FF0000',
          },
          original_price: {
            show: 1, // 0|1
            color: '#C4C4C4',
          },
          sales: {
            show: 1, // 0|1
            color: '#c4c4c4',
          },
        },
        buyNowStyle: {
          mode: 1,
          text: '去抢购',
          color1: themeColor[theme].color1,
          color2: themeColor[theme].color2,
          src: '',
        },
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        space: 0,
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    scoreGoods: {
      type: 'scoreGoods',
      data: {
        goodsIds: [],
        goodsList: [],
        mode: 1,
        goodsFields: {
          title: {
            show: 1, // 0|1
            color: '#333',
          },
          subtitle: {
            show: 1, // 0|1
            color: '#999',
          },
          score_price: {
            show: 1, // 0|1
            color: '#FF3000',
          },
          price: {
            show: 1, // 0|1
            color: '#C4C4C4',
          },
        },
        buyNowStyle: {
          mode: 1,
          text: '去兑换',
          color1: themeColor[theme].color1,
          color2: themeColor[theme].color2,
          src: '',
        },
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        space: 0,
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    mplive: {
      type: 'mplive',
      data: {
        mode: 1,
        goodsFields: {
          name: {
            show: 1, // 0|1
            color: '#FDFDFD',
          },
          anchor_name: {
            show: 1, // 0|1
            color: '#FDFDFD',
          },
        },
        mpliveIds: [],
        mpliveList: [],
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        space: 8,
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '',
        },
        marginLeft: 8,
        marginRight: 8,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    coupon: {
      type: 'coupon',
      data: {
        couponIds: [],
        couponList: [],
        mode: 1,
        fill: {
          color: '',
          bgImage: '',
        },
        button: {
          color: '',
          bgColor: '',
        },
        space: 0,
      },
      style: {
        background: {
          type: 'color',
          bgImage: '',
          bgColor: '#FFFFFF',
        },
        marginLeft: 0,
        marginRight: 0,
        marginTop: 0,
        marginBottom: 10,
        borderRadiusTop: 0,
        borderRadiusBottom: 0,
        padding: 0,
      },
    },
    // subscribeWechatOfficialAccount: {
    //     type: 'subscribeWechatOfficialAccount',
    //     data: {
    //         src: '',
    //         title: {
    //             text: '',
    //             textColor: ''
    //         },
    //         subtitle: {
    //             text: '',
    //             textColor: ''
    //         }
    //     },
    //     style: {
    //         background: {
    //             type: 'color',
    //             bgImage: '',
    //             bgColor: '#FFFFFF',
    //         },
    //         marginLeft: 0,
    //         marginRight: 0,
    //         marginTop: 0,
    //         marginBottom: 10,
    //         borderRadiusTop: 0,
    //         borderRadiusBottom: 0,
    //         padding: 0,
    //     },
    // },
  };
  return comp[type];
}

// 组件名称
export const compNameObj = {
  // splashScreen: '启动页',
  // guidePage: '引导页',
  tabbar: '底部导航',
  floatMenu: '悬浮按钮',
  popupImage: '弹窗广告',
  page: '页面设置',
  userCard: '会员卡片',
  orderCard: '订单卡片',
  orderCardNew: '新订单卡片',
  promotionCard: '推广卡片',
  walletCard: '资产卡片',
  couponCard: '卡券卡片',
  searchBlock: '搜索框',
  noticeBlock: '公告栏',
  listClass: '滑动菜单',
  menuButton: '菜单导航',
  menuSwiper: '轮播导航',
  menuButtonCustom: '自定义菜单导航',
  menuList: '列表导航',
  groupList: '团购列表',
  menuGrid: '宫格导航',
  goodsCard: '商品卡片',
  goodsClass: '商品列表02',
  shopGoodsList: '商城列表',
  shopGoodsList1: '商城列表1',
  blankView:'空白占位符',
  summerNewOne: '夏日焕新1',
  summerNewSecond: '夏日焕新2',
  wuyiOne: '五一嗨购1',
  wuyiTwo: '五一嗨购2',
  menuBanner: '菜单轮播',
  goodsShelves: '商品栏',
  yanxuangoods: '严选商品',
  activityShelves: '活动栏',
  imageBlock: '图片展示',
  imageBlock1: '图片展示1',
  offerBlock: '特价团',
  signCard:'签到卡片',
  customNavbar: '搜索导航',
  imageBanner: '图片轮播',
  titleBlock: '标题栏',
  imageCube: '广告魔方',
  videoPlayer: '视频播放',
  lineBlock: '辅助线',
  richtext: '富文本',
  hotzone: '热区',
  category: '分类区',
  groupon: '拼团',
  seckill: '秒杀',
  scoreGoods: '积分商城',
  mplive: '小程序直播',
  coupon: '优惠券',
  extend7: '个人中心',
  platformReco: '平台推荐',
  jxshopBlock: '鲸囍店铺',
  categoryTabs: '分类栏',
  menuBlock:'菜单块',
  // subscribeWechatOfficialAccount: '关注公众号',
};

// 初始化暂存数据
export function handleTempData(data) {
  console.log('handleTempData', data);
  data.data.forEach(async (t) => {
    if (['goodsCard', 'goodsShelves', 'yanxuangoods', 'jxshopBlock'].includes(t.type)) {
		if(t.type == 'jxshopBlock'){
			if(t.data?.hotGoodsIds&&t.data?.hotGoodsIds.length>0){

				const res1 = await goodsApi.goods.select(
					{
					  search: JSON.stringify({ id: [t.data.hotGoodsIds.join(','), 'in'] }),
					},
					'select',
				  );
				  t.data.hotGoodsList = res1.error === 0 ? res1.data : [];
			}
			if(t.data?.newGoodsIds&&t.data?.newGoodsIds.length>0){

				const  res2 = await goodsApi.goods.select(
				  {
					search: JSON.stringify({ id: [t.data.newGoodsIds.join(','), 'in'] }),
				  },
				  'select',
				);
				t.data.newGoodsList = res2.error === 0 ? res2.data : [];
			}

			if(t.data?.seckillGoodsIds&&t.data?.seckillGoodsIds.length>0){
				const res3 = await goodsApi.goods.select(
					{
					  search: JSON.stringify({ id: [t.data.seckillGoodsIds.join(','), 'in'] }),
					},
					'select',
				  );
				  t.data.seckillGoodsList = res3.error === 0 ? res3.data : [];
			}

		
		}else{
			const { error, data } = await goodsApi.goods.select(
			  {
				search: JSON.stringify({ id: [t.data.goodsIds.join(','), 'in'] }),
			  },
			  'select',
			);
			t.data.goodsList = error === 0 ? data : [];
		}
    } else if (t.type == 'goodsClass') {
      await t.data.templateList.forEach(async (obj) => {
        const { error, data } = await goodsApi.goods.select(
          {
            search: JSON.stringify({ id: [obj.goodsIds.join(','), 'in'] }),
          },
          'select',
        );
        obj.goodsList = error === 0 ? data : [];

      })
    } else if (t.type == 'shopGoodsList') {

      const { error, data } = await goodsApi.goods.select(
        {
          search: JSON.stringify({ id: [t.data.goodsIds.join(','), 'in'] }),
        },
        'select',
      );
      t.data.goodsList = error === 0 ? data : [];
    } else if (t.type == 'shopGoodsList1') {

      const { error, data } = await goodsApi.goods.select(
        {
          search: JSON.stringify({ id: [t.data.goodsIds.join(','), 'in'] }),
        },
        'select',
      );
      t.data.goodsList = error === 0 ? data : [];
    } else if (t.type == 'summerNewOne') {

      const { error, data } = await goodsApi.goods.select(
        {
          search: JSON.stringify({ id: [t.data.goodsIds.join(','), 'in'] }),
        },
        'select',
      );
      t.data.goodsList = error === 0 ? data : [];
    } else if (t.type == 'summerNewSecond') {

      const { error, data } = await goodsApi.goods.select(
        {
          search: JSON.stringify({ id: [t.data.goodsIds.join(','), 'in'] }),
        },
        'select',
      );
      t.data.goodsList = error === 0 ? data : [];
    }else if (t.type == 'wuyiOne') {

      const { error, data } = await goodsApi.goods.select(
        {
          search: JSON.stringify({ id: [t.data.goodsIds.join(','), 'in'] }),
        },
        'select',
      );
      t.data.goodsList = error === 0 ? data : [];
    }else if (t.type == 'wuyiTwo') {

      const { error, data } = await goodsApi.goods.select(
        {
          search: JSON.stringify({ id: [t.data.goodsIds.join(','), 'in'] }),
        },
        'select',
      );
      t.data.goodsList = error === 0 ? data : [];
    }
    else if (t.type == 'coupon') {
      const { error, data } = await couponApi.select(
        {
          search: JSON.stringify({ id: [t.data.couponIds.join(','), 'in'], status: ['normal'] }),
        },
        'select',
      );
      t.data.couponList = error === 0 ? data : [];
    } else if (t.type == 'richtext') {
      const { error, data } = await dataApi.richtext.select(
        {
          search: JSON.stringify({ id: [t.data.id, 'in'] }),
        },
        'find',
      );
      t.data.richtext = error === 0 ? data : [];
    } else if (t.type == 'groupon' || t.type == 'seckill') {
      if (t.data.activityId) {
        const detail = await activityApi.activity.detail(t.data.activityId);
        if (detail.error === 0) {
          t.data.activityList = [detail.data];
          const { error, data } = await goodsApi.goods.activitySelect({
            activity_id: t.data.activityId,
            need_buyers: t.type == 'groupon' ? 1 : 0,
          });
          t.data.goodsList = error === 0 ? data : [];
        } else {
          t.data.activityList = [];
          t.data.goodsList = [];
        }
      } else {
        t.data.activityList = [];
        t.data.goodsList = [];
      }
    } else if (t.type == 'scoreGoods') {
      const { error, data } = await appApi.scoreShop.select(
        {
          search: JSON.stringify({ id: [t.data.goodsIds.join(','), 'in'] }),
        },
        'select',
      );
      t.data.goodsList = error === 0 ? data : [];
    } else if (t.type == 'mplive') {
      const { error, data } = await appApi.mplive.room.select({
        search: JSON.stringify({ roomid: [t.data.mpliveIds.join(','), 'in'] }),
      });
      t.data.mpliveList = error === 0 ? data : [];
    } else if (t.type == 'activityShelves') {
      if (t.data.cardList[0].goodsIds.length > 0) {
        const { error, data } = await goodsApi.goods.select(
          {
            search: JSON.stringify({ id: [t.data.cardList[0].goodsIds.join(','), 'in'] }),
          },
          'select',
        );
        t.data.cardList[0].goodsList = error === 0 ? data : [];
      }

    } else if (t.type == 'promotionCard') {
      console.log('t.data.goodsIds:', t.data.goodsIds);

      const { error, data } = await goodsApi.goods.select(
        {
          search: JSON.stringify({ id: [t.data.goodsIds.join(','), 'in'] }),
        },
        'select',
      );
      t.data.goodsList = error === 0 ? data : [];
    } else if (t.type == 'categoryTabs') {
      if (!!t.data.id || t.data.id == 0) {
        const { error, data } = await categoryApi.detail(t.data.id)
        if (error === 0) {
          t.data.list = data.categories
        }
      }
    }
  });

  return data;
}

// 提交删除多余数据
export function handleSubmitData(data) {
  data.data.forEach((t) => {
    if (['goodsCard', 'goodsShelves', 'yanxuangoods', 'jxshopBlock'].includes(t.type)) {
		if(t.type == 'jxshopBlock'){
			t.data.hotGoodsIds = [];
			t.data.hotGoodsList.forEach((g) => {
			  t.data.hotGoodsIds.push(g.id);
			});
			delete t.data.hotGoodsList;

			t.data.newGoodsIds = [];
			t.data.newGoodsList.forEach((g) => {
			  t.data.newGoodsIds.push(g.id);
			});
			delete t.data.newGoodsList;
			
			t.data.seckillGoodsIds = [];
			t.data.seckillGoodsList.forEach((g) => {
			  t.data.seckillGoodsIds.push(g.id);
			});
			delete t.data.seckillGoodsList;
		}else{
			t.data.goodsIds = [];
			t.data.goodsList.forEach((g) => {
			  t.data.goodsIds.push(g.id);
			});
			delete t.data.goodsList;
		}
    } else if (t.type == 'goodsClass') {
      t.data.tabIndex = 0;
      t.data.templateList.forEach((obj) => {
        obj.goodsIds = [];
        obj.goodsList.forEach((g) => {
          obj.goodsIds.push(g.id);
        });
        delete obj.goodsList;
      });
    } else if (t.type == 'shopGoodsList') {
      t.data.goodsIds = [];
      t.data.goodsList.forEach((g) => {
        t.data.goodsIds.push(g.id);
      });
      delete t.data.goodsList;
    } else if (t.type == 'shopGoodsList1') {
      t.data.goodsIds = [];
      t.data.goodsList.forEach((g) => {
        t.data.goodsIds.push(g.id);
      });
      delete t.data.goodsList;
    } else if (t.type == 'summerNewOne') {
      t.data.goodsIds = [];
      t.data.goodsList.forEach((g) => {
        t.data.goodsIds.push(g.id);
      });
      delete t.data.goodsList;
    }else if (t.type == 'summerNewSecond') {
      t.data.goodsIds = [];
      t.data.goodsList.forEach((g) => {
        t.data.goodsIds.push(g.id);
      });
      delete t.data.goodsList;
    }else if (t.type == 'wuyiOne') {
      t.data.goodsIds = [];
      t.data.goodsList.forEach((g) => {
        t.data.goodsIds.push(g.id);
      });
      delete t.data.goodsList;
    }else if (t.type == 'wuyiTwo') {
      t.data.goodsIds = [];
      t.data.goodsList.forEach((g) => {
        t.data.goodsIds.push(g.id);
      });
      delete t.data.goodsList;
    }
    else if (t.type == 'coupon') {
      t.data.couponIds = [];
      t.data.couponList?.forEach((c) => {
        t.data.couponIds.push(c.id);
      });
      delete t.data.couponList;
    } else if (t.type == 'richtext') {
      delete t.data.richtext;
    } else if (t.type == 'groupon' || t.type == 'seckill') {
      t.data.activityId = [];
      t.data.activityList.forEach((c) => {
        t.data.activityId.push(c.id);
      });
      t.data.activityId = t.data.activityId.join(',');
      delete t.data.activityList;
      delete t.data.goodsList;
    } else if (t.type == 'scoreGoods') {
      t.data.goodsIds = [];
      t.data.goodsList.forEach((c) => {
        t.data.goodsIds.push(c.id);
      });
      delete t.data.goodsList;
    } else if (t.type == 'mplive') {
      t.data.mpliveIds = [];
      t.data.mpliveList.forEach((c) => {
        t.data.mpliveIds.push(c.roomid);
      });
      delete t.data.mpliveList;
    } else if (t.type == 'activityShelves') {
      //处理数据
      t.data.cardList[0].goodsId = [];
      t.data.cardList[0].goodsList.forEach((v) => {
        t.data.cardList[0].goodsIds.push(v.id);
      });

      t.data.cardList[1].goodsIds = [];
      t.data.cardList[1].goodsList.forEach((v) => {
        t.data.cardList[1].goodsIds.push(v.id);
      });
    } else if (t.type == 'promotionCard') {
      //处理数据

      t.data.goodsList.forEach((v) => {
        t.data.goodsIds.push(v.id);
      })
      t.data.goodsIds = Array.from(new Set(t.data.goodsIds))
    } else if (t.type == 'categoryTabs') {
      t.data.list = []
    }
  });

  return data;
}
